In C++, every expression results in either an lvalue or an rvalue. This distinction defines whether an expression refers to an object’s identity (where it is) or its value (what it contains).
1. Identity vs. Contents
An lvalue (locator value) represents an object with a persistent memory address. Think of it as a labeled box in RAM. Conversely, an rvalue (read value) is transient; it represents a temporary result or a literal that does not have an address accessible to the programmer.
2. Functional Transitions
While an lvalue can act as an rvalue (the compiler simply fetches the value inside the box), the reverse is forbidden. You cannot use an rvalue where an lvalue is required—for instance, you cannot take the address of a literal number like &42 because it lacks a persistent identity.
$$ \text{Lvalue} \xrightarrow{\text{Conversion}} \text{Rvalue} \quad (\text{Allowed}) $$
$$ \text{Rvalue} \xrightarrow{\text{Assignment}} \text{Lvalue} \quad (\text{Forbidden}) $$